(define *kR:sets* (list))
(define *kR:current-set* "default")
(define *kR:in-set-load* #f)

;; Use this to define a set
;; syntax:
;
;  (set "Demo Set"
;       ;optional init code
;       (init-code)
;       
;       (song "Song1"
;             (instr "Test" "dls " "appl")
;             ...)
;       (load-song "Song2"
;             ...)
;       ...
;  )
(define-macro (set name . body)
   `(set! *kR:current-set* name)
   `(set-obj-for-key! ,name (lambda () ,@body) *kR:sets*))

;load a set
(define (load-set name)
     ;switch to set loading mode
     (set! *kR:in-set-load* #t)
   
     ;reset *kR:sets
     (set! *kR:songs* (list))
     (set *kR:current-set* name)
     (init-graph)
                    
     ;load alls the new songs/init code
     (if (assoc name *kR:sets*)
         ((cdr (assoc name *kR:sets*))))
   
     ;leave set loading mode
    (set! *kR:in-set-load* #f) 
   )